#ifndef PINQAPPUI_H
#define PINQAPPUI_H

#include <QikAppUi.h>
#include <QikEditCategoryObserver.h>
#include "PinQModel.h"
#include "PinQDocument.h"
#include <MQikListBoxObserver.h>
class CPinQListView;
class CPinQTaskView;
class CPinQPacketsView;

class CPinQAppUi : public CQikAppUi,public MQikEditCategoryObserver,public CPinQTask::MObserver
    {
public:
	CPinQAppUi();
	void ConstructL();
	~CPinQAppUi();

	TInt CurrentCategoryHandle() const;
	void SetCurrentCategoryHandle(TInt aCategoryHandle);
	void HandleCategoryChangeL(TInt aCategoryHandle);
	void EditCategoryL();
	CQikCategoryModel* CategoryModelInstance();
	inline CPinQModel& PinQModel(){return PinQDocument().PinQModel();}
	inline CPinQDocument& PinQDocument() {return *static_cast<CPinQDocument*>(Document());}
private: 
	//from MQikCategoryObserver
	TBool OkToAddCategory() const;
	TBool DoAddCategoryL(TInt& aHandle);
	TBool OkToRenameCategory(TInt aHandle, const TDesC& aNewName) const;
	TBool DoRenameCategoryL(TInt aHandle, const TDesC& aNewName);
	TBool OkToMergeCategories(TInt aSourceHandle, TInt aTargetHandle) const;
	TBool DoMergeCategoriesL(TInt aSourceHandle, TInt aTargetHandle);
	TBool OkToDeleteCategory(TInt aHandle) const;
	TBool DoDeleteCategoryL(TInt aHandle);
	TBool IsCategoryEmpty(TInt aHandle) const;
	void CategoryChangedL();
	// from CPinQTask::MObserver
	virtual void TaskStateChangedL(const CPinQTask& aTask,CPinQTask::TState aNewState);
		
private:
	TInt iCurrentCategoryHandle;
	CQikCategoryModel* iCategoryModelInstance;
	CPinQListView* iPinQListView;
	CPinQTaskView* iPinQTaskView;
	CPinQPacketsView* iPinQPacketsView;
	void SetChoiceListDirty();
	};

#endif // PINQAPPUI_H
